package com.mnsq.common.bean.enums;

/**
 * @author Administrator
 */

public enum ErrorCodeEnum {
    NO_LOGIN(20001, "请登录", "登录失效或未登录"),
    LOGIN_FAIL(20002, "用户名或密码错误", "登录失败"),
    BIND_FAIL(20003, "绑定用户信息失败", "缺少参数"),
    UN_BIND_FAIL(20004, "解除绑定用户信息失败", "缺少参数"),
    USER_EXIST(20005, "用户名已存在，请直接登录", "已存在用户"),
    ACCOUNT_WRONG(20006, "用户名格式错误，请重新输入", "格式错误"),
    CODE_WRONG(20007, "验证码错误，请重新输入", "邮箱或手机号验证码未填，或者填写错误"),
    ACCOUNT_EMPTY(20008, "请输入用户名", "邮箱或手机号重置密码，用户名未填"),
    PWD_EMPTY(20008, "请输入新密码", "邮箱或手机号重置密码，密码未填"),
    NOT_VALID_PARAM(10001, "请输入有效数据", "缺少参数"),
    OPERA_FAIL(10002, "操作失败", "执行程序错误");

    public Integer code;
    public String msg;
    public String description;

    ErrorCodeEnum(Integer code, String msg, String description) {
        this.code = code;
        this.msg = msg;
        this.description = description;
    }

    public static ErrorCodeEnum getErrorCodeEnum(Integer code) {
        for (ErrorCodeEnum ece : ErrorCodeEnum.values()) {
            if (ece.code.equals(code)) {
                return ece;
            }
        }
        return null;
    }
}
